import React, {startTransition, useEffect, useState} from 'react';
import {HomeNewStyle} from "./style";
import SectionHeader from "../../components/sectionHeader";
import {getHomeGoodPriceData} from "../../services/modules/home";
import SectionRooms from "../../components/sectionRooms";

const Home2 = () => {

    const [goodPriceInfo, setGoodPriceInfo] = useState([])

    // goodPriceInfo.length===0 && startTransition(() => {
    //     getHomeGoodPriceData().then(data => {
    //         data && setGoodPriceInfo(data)
    //     })
    // })

    useEffect(() => {
        getHomeGoodPriceData().then(data => {
            data && setGoodPriceInfo(data)
        })
    }, [])

    return (
        <HomeNewStyle>
            <div className='img'/>

            <div className='content'>
                <div className='good-price'>
                    <SectionHeader title={goodPriceInfo?.title}/>
                    <SectionRooms roomList={goodPriceInfo?.list} />
                </div>
            </div>
        </HomeNewStyle>
    );
};

export default Home2;